//收藏本站
function AddFavorite(title, url) {
  try {
      window.external.addFavorite(url, title);
  }
  catch (e) {
      try {
          window.sidebar.addPanel(title, url, "");
      }
      catch (e) {
          alert("抱歉，您所使用的浏览器无法完成此操作。\n\n加入收藏失败，请使用Ctrl+D进行添加");
      }
  }
}

  // --------------------------------------------------------------------
  // goTop
  // --------------------------------------------------------------------

$(function(){
  //首先将#back-to-top隐藏
  $("#slider-goTop").hide();
  //当滚动条的位置处于距顶部100像素以下时，跳转链接出现，否则消失
  $(window).scroll(function(){
      if ($(window).scrollTop()>100){
          $("#slider-goTop").fadeIn();
      }else{
          $("#slider-goTop").fadeOut();
      }
  });
  //当点击跳转链接后，回到页面顶部位置
  $("#slider-goTop").click(function(){
      $('body,html').animate({scrollTop:0},500);
      return false;
  });
  //返回顶部等滑块hover事件
  $('#clan-slider>ul>li').hover(
      function(){
          $(this).children().last().show();
      },
      function(){
        $(this).children().last().hide();
      }
  );
});


$(function () {
  // --------------------------------------------------------------------
  // One Page Navigation
  // --------------------------------------------------------------------

  (function () {
    $(window).scroll(function () {
      if ($(this).scrollTop() >= 50) {
        $("nav.navbar").addClass("sticky-nav");
      } else {
        $("nav.navbar").removeClass("sticky-nav");
      }
    });
  })();

  var upsSwiper = new Swiper("#banner-swiper-container", {
    speed: 1000,
    longSwipes: false,
    loop: true,
    autoplay: {
      disableOnInteraction: false,
    },
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    on: {
      autoplayStop: function () {
        this.$el.find(".ups-icon-videoplay").addClass("stop-status");
      },
      autoplayStart: function () {
        this.$el.find(".ups-icon-videoplay").removeClass("stop-status");
      },
    },
  });

  // upsSwiper.$el.find(".ups-icon-videoplay").on("click", function () {
  //   if (upsSwiper.autoplay.running) {
  //     upsSwiper.autoplay.stop();
  //   } else {
  //     upsSwiper.autoplay.start();
  //   }
  // });

  // swiperHeight = upsSwiper.height;

  // window.onscroll = function scroll() {
  //   if (window.pageYOffset / upsSwiper.height < 1) {
  //     scrollScale = window.pageYOffset / swiperHeight;
  //   } else {
  //     scrollScale = 1;
  //   }

  //   upsSwiper.slides
  //     .find(".img")
  //     .transform("translateY(-" + 18 * scrollScale + "%)"); //滚动一屏swiper高度则图片向上18%（范围0-40）
  // };
});

$(function () {
  //
  var swiper = new Swiper("#jtye-swiper-container", {
    effect: "coverflow",
    grabCursor: true,
    centeredSlides: true,
    slidesPerView: "auto",
    initialSlide: 3,
    coverflowEffect: {
      rotate: 50,
      stretch: 0,
      depth: 100,
      modifier: 1,
      slideShadows: true,
    },
    // pagination: {
    //   el: "#jtye-swiper-pagination",
    // },
  });
});

// 合作客户
$(function () {
  //   var swiper = new Swiper("#womendekehu-swiper-container", {
  //     slidesPerView: 5,
  //     slidesPerColumn: 2,
  //     spaceBetween: 30,
  //     speed: 1000,
  //     longSwipes: false,
  //     loop: true,
  //     autoplay: {
  //       disableOnInteraction: false,
  //     },
  //     pagination: {
  //       el: ".swiper-pagination",
  //       clickable: true,
  //     },
  //   });
});
